<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open connstr
strSQL = "SELECT Queries.QueryID, Queries.QueryName, Queries.QueryContent, QueryFields.FieldID, QueryFields.FieldName FROM QueryFields INNER JOIN Queries ON QueryFields.QueryID = Queries.QueryID WHERE Queries.QueryID = '" & strSuppliedQID & "'"
If Session("UserStatus") <> "researching" OR Session("Authorised") <> "yes" Then
strSQL = strSQL & " AND Queries.QuerySecurity = '0'"
End If
Set rs = conn.Execute(strSQL)
If Not rs.eof Then
strQueryID = rs.fields("QueryID")
strQueryName = rs.fields("QueryName")
strQueryContent = rs.fields("QueryContent")
strFieldID = rs.fields("FieldID")
strFieldName = rs.fields("FieldName")
strSQL = "SELECT Count(QueryFields.FieldID) AS NumberofFields FROM QueryFields INNER JOIN Queries ON QueryFields.QueryID = Queries.QueryID WHERE Queries.QueryID = '" & strSuppliedQID & "'"
Set rs2 = conn.Execute(strSQL)
intNumberOfFields = rs2.fields("NumberofFields")
%>
Here are the results of the "<%=strQueryName%>" query:
|
<%=strQueryName%>
|
|
Record no.
|
<%
Do While Not rs.eof
%>
<%=rs.fields("FieldName")%>
|
<%
rs.movenext
loop
Set rs1 = conn.Execute(strQueryContent)
intRecordCount = 1
DO While Not rs1.eof
%>
|
<%=intRecordCount%>
|
<%
intRecordCounter = 0
Do While intRecordCounter < intNumberOfFields
%>
 <%=rs1(intRecordCounter)%>
|
<%
intRecordCounter = intRecordCounter + 1
loop
rs1.movenext
intRecordCount = intRecordCount + 1
loop
rs.close
SET rs = nothing
rs1.close
SET rs1 = nothing
%>
Click here to return to the statistics
page.
<%
Else
%>
Sorry - either there is no query found corresponding to the
URL you used, or you do not have the security clearance to
access it. Click here to return to the statistics
page.
<%
End If
%>
|